<template>
  <div class="home">
    <!-- 头部轮播图 -->
    <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="(item, i) in data.banner" :key="i">
        <img :src="item.banner_img" alt="" />
      </van-swipe-item>
    </van-swipe>
    <!-- 热门推荐 -->
    <navSwipter></navSwipter>
    <!-- 资深讲师 -->
    
    <goodList :list="list" ></goodList>
    <!-- 底部导航栏 -->
    <!-- <TabberBtn></TabberBtn> -->
  </div>
</template>

<script setup>
import navSwipter from "@/components/nav.vue";
import { getBanner, getUserList } from "@/tool/swipter";
// import TabberBtn from "@/components/tabber.vue";
import goodList from "../components/goodList.vue";
import {ref, reactive, onMounted } from "vue";
const list = ref([])
const data = reactive({
  banner: [],
});

onMounted(() => {
  getList();
  getbanners();
});

const getList = async () => {
  let res = await getUserList();
  // console.log(res);
  list.value = res.data;
  // console.log(list.value);
};
const getbanners = async () => {
  let res = await getBanner();
  // console.log(res);
  data.banner = res.data;
};
</script>
<style lang="scss" scoped>
* {
  padding: 0;
  margin: 0;
}
.home {
  position: relative;
  width: 100%;

  background-color: #f2f3f5;
  .my-swipe {
    width: 100%;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
